package com.moji.controller.api;


import com.moji.common.base.ApiResult;
import com.moji.entity.SysMessage;
import com.moji.entity.dto.QueryMessageDto;
import com.moji.service.SysMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 系统消息表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-08-10
 */
@RestController
@RequestMapping("web/auth/sysMessage")
@Api(tags = "消息提醒web相关接口(控制中心)", value = "消息提醒web相关接口(控制中心)")
public class SysMessageController {

    @Resource
    private SysMessageService sysMessageService;

    @PostMapping("/queryByPage")
    @ApiOperation(value = "消息提醒_分页查询",response = SysMessage.class)
    public ApiResult queryByPage(@RequestBody QueryMessageDto dto){
        return ApiResult.ok(sysMessageService.queryByPage(dto));
    }

    @PostMapping("/detail")
    @ApiOperation(value = "消息提醒_详情",response = SysMessage.class)
    public ApiResult detail(@RequestParam("id") Long id){
        return ApiResult.ok(sysMessageService.detail(id));
    }


    @GetMapping("/delete")
    @ApiOperation(value = "消息提醒_删除",response = Boolean.class)
    public ApiResult delete(@RequestParam("ids") List<Long> ids){
        return ApiResult.ok(sysMessageService.delete(ids));
    }

    @GetMapping("/isRead")
    @ApiOperation(value = "消息提醒_标记已读",response = Boolean.class)
    public ApiResult isRead(@RequestParam("ids") List<Long> ids){
        return ApiResult.ok(sysMessageService.isRead(ids));
    }
}

